Open Shortest Path First (OSPF) is a link-state routing protocol for Internet Protocol (IP) networks. OSPF uses a link state routing algorithm and falls into the group of interior routing protocols, operating within a single autonomous system (AS). OSPF is an interior gateway protocol that routes Internet Protocol (IP) packets solely within a single routing domain (autonomous system). OSPF gathers link state information from available routers and constructs a topology map of the network. The topology determines the routing table presented to the Internet Layer which makes routing decisions based solely on the destination IP address found in IP packets.
OSPF detects changes in the topology, such as link failures, very quickly and converges on a loop-free routing structure quickly. OSPF computes the shortest path tree for each route using a shortest path first algorithm. The OSPF routing policies used to construct a route table are governed by link cost factors (external metrics) associated with each routing interface. Cost factors may be the distance of a router (round-trip time), network throughput of a link, or link availability and reliability, expressed as simple unitless numbers. This provides a dynamic process of traffic load balancing between routes of equal cost.
Another interior routing protocol is Intermediate System To Intermediate System (ISIS). ISIS is an interior gateway protocol, designed for use within an administrative domain or network. ISIS determines the best route for packets through a packet-switched network. ISIS is a link-state routing protocol, operating by reliably flooding link state information throughout a network of routers. Each ISIS router independently builds a database of the network's topology, aggregating the flooded network information. Like the OSPF protocol, ISIS computes the best path through a network. Packets are then forwarded, based on the computed ideal path, through the network to the destination.
Routing protocols like ISIS and OSPF use internal cost to the advertising router as the primary tie-breaker when making route selection decisions. When the same route is advertised by multiple routers, the route from the router that has the lowest internal cost (Layer 1 (L1) cost or internal gateway Protocol (IGP) cost) is accepted. Sometimes network operators may want route selection not to be based on the internal cost, but instead to be based on an externally defined cost metric that they control before the routes are injected into the IGP. One of the primary reasons to do this is to achieve consistent primary/backup destination behaviors for traffic going out of the network (through firewalls for example) irrespective of the topology or path costs internal to the network.
OSPF has a standard defined way for advertising routers to identify a route type as internal or external and for external routes using the external metric as the primary tie-breaker during route selection.